#ifndef _OCPP_GribSyncFile_H__

#include "GribDefine.h"
#include "OCVolume/VolumeOptions.h"
#include "OCVolume/GridDataReader.h"

namespace OCPP
{
	using namespace Volume;
	class _GribExport GribSyncFile
	{
	public:
		using NcSyncFileInstances = std::map<String, std::shared_ptr<GribSyncFile> >;

		static std::mutex intanceMutex;
		static NcSyncFileInstances instances;

		GribSyncFile();
		~GribSyncFile();
		bool open(String fileName);

		GribVariablePtr getVar(String name);
		VariableMap getVars();

		VarData getData(GribVariable* variable, GridShape& origin, GridShape& shape, const VolumeOptions& options);
		GribOutput getData(std::shared_ptr<GribVariable> variable,GribTime time,int levelIndex, const VolumeOptions& options);
	private:
		VarData getData(InventoryEx* inv);
		std::ifstream ncFile;
		VariableMap mVariableMap;
		CORE_MUTEX(mutex);
	};
}


#endif // !_OCPP_GribReader_H__
